package com.isn.historiaclinica.jpa;

import java.util.List;
import javax.persistence.TypedQuery;
import com.isn.historiaclinica.entity.HistoriaClinica;
import com.isn.util.GenericoJPA;

public class HistoriaClinicaJPA extends GenericoJPA{
	private static final long serialVersionUID = 1L;

	public List<HistoriaClinica> buscarHC(HistoriaClinica hc){
		TypedQuery<HistoriaClinica> emquery = 
				em.createNamedQuery("HistoriaClinica.find",HistoriaClinica.class);
		emquery.setParameter("numHc", hc.getNumHc());
		emquery.setParameter("nomPac", hc.getNomPac());
		emquery.setParameter("apePatPac", hc.getApePatPac());
		emquery.setParameter("apeMatPac", hc.getApeMatPac());
		return emquery.getResultList();
	}
	
	public HistoriaClinica obtenerHC(String numHc){
		TypedQuery<HistoriaClinica> emquery = 
				em.createNamedQuery("HistoriaClinica.findByNumHc",HistoriaClinica.class);
		emquery.setParameter("numHc", numHc);
		return emquery.getSingleResult();
	}
	
}
